/**
 * \file  calibration.h
 *
 * \author  Piyush Khandelwal (piyushk@cs.utexas.edu)
 * Copyright (C) 2012, Austin Robot Technology, University of Texas at Austin
 *
 * License: Modified BSD License
 *
 * $ Id: 02/14/2012 11:25:34 AM piyushk $
 */

#ifndef __lidar209_CALIBRATION_H
#define __lidar209_CALIBRATION_H

#include <map>
#include <string>

namespace lidar209_pointcloud {

struct LaserCorrection {

  int laser_id;
  int x1;
  int x2;
  int x3;
  double fix_offset;
  double chs_offset;
  double k1;
  double k2;
  double b;
  double t1;
  double t2;
  double t3;
  double t4;
  double t5;
  int A_corr;
};

/** \brief Calibration information for the entire device. */
class Calibration {

public:
  float distance_resolution_m;
  std::map<int,LaserCorrection> laser_corrections_map;
  std::vector<LaserCorrection> laser_corrections;
  int num_lasers;
  int Alpha_corr11;
  int Alpha_corr12;
  int Alpha_corr13;
  int Alpha_corr14;
  int Alpha_corr21;
  int Alpha_corr22;
  int Alpha_corr23;
  int Alpha_corr24;

  int Alpha_corr0;
  int Beta_corr0;
  int Rotation_corr0;

  int Serial;
  int Detector1;
  int Detector2;
  int Optics1;
  int Optics2;
  int Electro;

  bool initialized;
  bool ros_info;

public:

  Calibration(bool info=true):
    initialized(false), ros_info(info) {}
  Calibration(const std::string& calibration_file,
              bool info=true):
    ros_info(info)
  {
    read(calibration_file);
  }

  void read(const std::string& calibration_file);
  //  void write(const std::string& calibration_file);
};

} /* lidar209_pointcloud */


#endif /* end of include guard: __lidar209_CALIBRATION_H */


